package de.baumann.browser.api.net

import de.baumann.browser.BuildConfig
import de.baumann.browser.api.net.base.BaseUrl
import de.baumann.browser.api.net.vo.Result
import de.baumann.browser.api.net.vo.duobao.Address
import de.baumann.browser.api.net.vo.duobao.DuoBao
import de.baumann.browser.api.net.vo.duobao.DuoBaoOrder
import de.baumann.browser.api.net.vo.duobao.JiangPin
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

@BaseUrl("${BuildConfig.DUOBAO_API_URL}api/")
interface DuoBaoOrderApiService {

    @POST("myPage/order/process")
    fun process(): Observable<Result<List<DuoBao>>>

    @POST("myPage/order/announce")
    fun yiJieXiao(): Observable<Result<List<DuoBaoOrder>>>

    @POST("myPage/order/win")
    fun jiangpin(): Observable<Result<List<DuoBao>>>

    @FormUrlEncoded
    @POST("myPage/order/win/delivery")
    fun wuliu(@Field("activityId") id: String): Observable<Result<JiangPin>>

    @POST("myPage/address/get")
    fun getAddress(): Observable<Result<Address>>

    @FormUrlEncoded
    @POST("sms/sendSms")
    fun sendSms(@Field("phone") phone: String): Observable<Result<Any>>

    @FormUrlEncoded
    @POST("sms/verifycode")
    fun yz(@Field("phone") phone: String, @Field("remark") remark: String): Observable<Result<Any>>

    @FormUrlEncoded
    @POST("myPage/address/insert")
    fun tjdz(@Field("name") name: String,
             @Field("phone") phone: String,
             @Field("address") address: String,
             @Field("address_info") address_info: String): Observable<Result<Any>>


    @FormUrlEncoded
    @POST("myPage/address/update")
    fun dzgx(@Field("name") name: String,
             @Field("phone") phone: String,
             @Field("address") address: String,
             @Field("address_info") address_info: String): Observable<Result<Any>>
}